<template>
  <div class="minaddBxo" v-loading="loading">
      <el-form label-width="120px" label-position="top" :model="addForm" ref="addForm">
          
          
          
          <el-form-item label="A方资产是否确认可交易" prop="aAssetCanTrade" :rules="{required: true, message: '请选择', trigger: 'blur'}">
            <el-radio-group v-model="addForm.aAssetCanTrade">
                <el-radio :label="1">是</el-radio>
                <el-radio :label="2">否</el-radio>
            </el-radio-group>
          </el-form-item>
          <el-form-item label="" prop="aAssetCanTradeDetail" :rules="{required: true, message: '资产状况不能为空', trigger: 'blur'}">
              <el-input size="small" type="textarea" v-model="addForm.aAssetCanTradeDetail" auto-complete="off" placeholder="请输入经调查的资产状况"></el-input>
          </el-form-item>
          <el-form-item label="B方资产是否确认可交易" prop="bAssetCanTrade" :rules="{required: true, message: '请选择', trigger: 'blur'}">
            <el-radio-group v-model="addForm.bAssetCanTrade">
                <el-radio :label="1">是</el-radio>
                <el-radio :label="2">否</el-radio>
            </el-radio-group>
          </el-form-item>
          <el-form-item label="" prop="bAssetCanTradeDetail" :rules="{required: true, message: '资产状况不能为空', trigger: 'blur'}">
              <el-input size="small" type="textarea" v-model="addForm.bAssetCanTradeDetail" auto-complete="off" placeholder="请输入经调查的资产状况"></el-input>
          </el-form-item>
          

          <el-form-item label="请最终确认本次交易是否已具备启动流程：" prop="tradeType" :rules="{required: true, message: '请选择', trigger: 'blur'}">
              <el-select size="small" v-model="addForm.tradeType" placeholder="请最终确认本次交易是否已具备启动流程">
                  <el-option v-for="item in asTypeArr" :label="item.name" :value="item.value" :key="item.value"></el-option>
              </el-select>
          </el-form-item>

          <el-form-item label="是否可以交易：" prop="canTrade" :rules="{required: true, message: '请选择', trigger: 'blur'}">
            <el-radio-group v-model="addForm.canTrade">
                <el-radio :label="1">是</el-radio>
                <el-radio :label="2">否</el-radio>
            </el-radio-group>
          </el-form-item>
      </el-form>

      <div class="minaddBxo-footer">
          <button @click="submitForm('addForm')">提交</button>
      </div>
  </div>
</template>

<script>
import { ConfirmBothAsset } from '../../../api/userMG'
export default {
    props: ['name','swapId'],
data() {
  return {
    loading:false,
    
    addForm: {
        "swapId": this.swapId,
        "aAssetCanTrade": "",
        "aAssetCanTradeDetail": "",
        "bAssetCanTrade": "",
        "bAssetCanTradeDetail": "",
        "tradeType": "",
        "canTrade": ""
    },

    asTypeArr:[
        // {name:'请选择',value:0},
        {name:'启动同台交易流程',value:1},
        {name:'启动担保交易流程',value:2},
        {name:'启动委外贸易交易流程',value:3},
    ],
  }
},

methods: {
  submitForm(formName){
      this.$refs[formName].validate(valid => {
          if (valid) {
              this.loading = true;
              ConfirmBothAsset(this.addForm).then(res => {
                  this.loading = false;
                  if (res.code != 0) {
                      this.$message({
                          type: 'info',
                          message: res.message
                      })
                  } else {
                      this.$message({
                          type: 'success',
                          message: '提交成功!'
                      })
                    this.$emit('onNext',this.name)
                      
                      
                  }
              })
          }
      })
      return
  }
}
}
</script>

<style scoped>
  .ipt_div{
      text-align: center;
      border: 1px solid #DCDFE6;
      border-radius: 4px;
      height: 40px;
  }
  .minaddBxo{
      width: 900px;
      margin: 0 auto;
  }
  .minaddBxo .el-select{
      width: 100%;
  }
  .minaddBxo /deep/ .el-form-item__label{
      padding: 0 !important;
  }

  .minaddBxo /deep/ .el-input__inner{
      line-height: 40px;
      height: 40px;
      text-align: center;
  }
  .minaddBxo-footer button{
      background:#1C1E22;
      color: #fff;
      border-radius: 30px;
      width: 300px;
      border:0;
      line-height: 46px;
      font-size: 16px;
      margin: 50px auto 100px;
      display: block;
      cursor: pointer;
  }
</style>